<!--
 * @Descripttion:
 * @version: 1.0
 * @Author: wuhao
 * @Date: 2021-10-09 15:12:21
 * @LastEditors: wuhao
 * @LastEditTime: 2021-10-11 09:37:22
-->
<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import { mapActions } from 'vuex'
import { getBussinessInfo } from "./api/zwfw-service";

export default {
  name: 'App',
  beforeCreate() {
    // 根据不同设备的理想视口宽度动态设置根元素的`font-size`。
    let idealViewWidth = window.screen.width;
    if (idealViewWidth > 750) {
      idealViewWidth = 750
    }
    const BASICVALUE = 750;
    document.documentElement.style.fontSize = (idealViewWidth / BASICVALUE) * 100 + 'px';
  },
  mounted() {
    getBussinessInfo({ "type": "common" }).then((res) => {
      if (res.status == 0 && res.result) {
        this.$globalEnv.enableFaceID = res.result.faceFlag;
        this.$globalEnv.projCode = res.result.projCode;
      }
    });

    if (this.$globalEnv.testData) {
      ////测试环境初始化用户
      if (process.env.NODE_ENV == 'jz') {
        let user = {
          names: "李艳云",
          idCards: "420684199104255526"
        }
        this.setUserInfo(user)
      } else if (process.env.NODE_ENV == 'ez') {
        let user = {
          names: "陈欢",
          idCards: "421122199410051040"
        }
        this.setUserInfo(user)
      } else if (process.env.NODE_ENV == 'hs') {
        let user = {
          names: "张云浩",
          idCards: "420222198210261422"
        }
        this.setUserInfo(user)
      } else if (process.env.NODE_ENV == 'snj') {
        let user = {
          names: "周琼",
          idCards: "429021199112082020"
        }
        this.setUserInfo(user)
      }
    } else {
      let that = this;
      ehbAppJssdk.user.getUserInfo({
        success: function (res) {
          that.setUserInfo(res);
        }
      })
    }
  },
  methods: {
    ...mapActions('app', ['setUserInfo'])
  }
}
</script>

<style>
#app {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0px;
  bottom: 0px;
}
</style>
